$().ready(function(){literal}{{/literal}
{foreach from=$js_values item=rules key=field name=values_loop}
{foreach from=$rules item=rule name=rules_loop}
{if strlen($rule.custom_script) gt 0}
jQuery.validator.addMethod("{$rule.restriction}",function(value,element,params){literal}{{/literal}
    {$rule.custom_script}
{literal}}{/literal});
{/if}
{/foreach}
{/foreach}
//start on ready
	$('#{$id_form}').validate({literal}{{/literal}
	//start validate
	rules : {literal}{{/literal}
	{foreach from=$js_values item=rules key=field name=values_loop}
		{$field} : {literal}{{/literal}
			{foreach from=$rules item=rule name=rules_loop}
				{$rule.restriction} : {$rule.value}{if !$smarty.foreach.rules_loop.last}, {/if}
			{/foreach}
			{literal}}{/literal}{if !$smarty.foreach.values_loop.last}, {/if}
	{/foreach}
	{literal}}{/literal}

	,messages : {literal}{{/literal}
	{foreach from=$js_values item=rules key=field name=values_loop}
		{$field} : {literal}{{/literal}
			{foreach from=$rules item=rule name=rules_loop}
				{$rule.restriction} : "{$rule.message}"{if !$smarty.foreach.rules_loop.last}, {/if}
			{/foreach}
			{literal}}{/literal}{if !$smarty.foreach.values_loop.last}, {/if}
	{/foreach}
	{literal}}{/literal}
	{if isset($groups)}
	,groups : {literal}{{/literal}
	{foreach from=$groups item=rules key=field name=groups_loop}
		{$field} : {literal}{{/literal}"{$rules}"{literal}}{/literal}{if !$smarty.foreach.groups_loop.last}, {/if}
	{/foreach}
	{literal}}{/literal}
	{/if}
	,errorElement: "{if isset($errorElement)}{$errorElement}{else}p{/if}"
	,errorClass: "{if isset($errorClass)}{$errorClass}{else}warning{/if}"
	{if isset($submitHandler)}
	,submitHandler:function(form){literal}{{/literal}{$submitHandler}{literal}}{/literal}
	{/if}
	{if isset($errorPlacement)}
	,errorPlacement:function(error, element) {literal}{{/literal}{$errorPlacement}{literal}}{/literal}
	{/if}
	//end vlaidate
	{literal}}{/literal});

//end onready
{literal}}{/literal});